package com.cjm.algorithm.dp;

public class Ti300 {
    public static void main(String[] args) {

    }

    public int lengthOfLIS(int[] nums) {
        if (nums.length < 2) {
            return nums.length;
        }
        int[] dp = new int[nums.length + 1];
        for (int i = 0; i < dp.length; i++) {
            dp[i] = 1;
        }

        int result = 0;
        for (int i = 1; i < nums.length; i++) {
            for (int j = 0; j < i; j++) {
                if (nums[i] > nums[j]) {
                    dp[i] = Math.max(dp[j] + 1, dp[i]);
                }
            }
            result = dp[i] > result ? dp[i]: result;
        }
        return result;
    }
}
